import wx

def align(str):
    str = str.lower()
    
    flags = {"left": wx.ALIGN_LEFT,
             "center": wx.ALIGN_CENTER_HORIZONTAL,
             "right": wx.ALIGN_RIGHT}
    
    return flags.get(str, 0)

def valign(str):
    str = str.lower()
    
    flags = {"top": wx.ALIGN_TOP,
             "center": wx.ALIGN_CENTER_VERTICAL,
             "bottom": wx.ALIGN_BOTTOM}
    
    return flags.get(str, 0)


def border(str):
    str = str.lower()
    
    flags = {"left": wx.LEFT,
             "right": wx.RIGHT,
             "top": wx.TOP,
             "bottom": wx.BOTTOM,
             "all": wx.ALL}
    
    borders = str.split(',')
    borders = filter(None, map(lambda x: x.strip(), borders))

    value = 0

    for item in borders:
        value |= flags.get(item, 0)

    return value